
public class SpreadButton extends Thread {
	private HsiTradingThread data;
	private volatile boolean isSuspend = false;
	public SpreadButton( HsiTradingThread hsi){
		data = hsi;
	}
	public synchronized void doSuspend() {
		isSuspend = true;	
	}
	
	public synchronized void doResume() {
		isSuspend = false;
		notify();
	}
	
	public void run(){
		while( data.spreadEnable){
			data.sendSpreadOrderToTWS();	
			try {
				Thread.sleep( data.tradingPanel.timeInterval );
				synchronized (this) {
					while (isSuspend) {
						wait();
					}
				}
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
					
		}
	}
}
